import request from "@/utils/request";

export const login = (data: LoginForm) => {
  return request.post("/user/login", data);
};

export const register = (data: RegisterForm) => {
  return request.post("/user/signUp", data);
};

export const getUserInfo = () => {
  return request.get("/user-profile/info");
};

export const logout = () => {
  return request.post("/user/logout");
};

export const sendEmailCode = (email: string) => {
  return request.post("/user/code", {
    email,
  });
};

export const getFollows = () => {
  return request.get("/following/list");
};

export const getFansList = () => {
  return request.get("/followers/list");
};

export const getFriendList = () => {
  return request.get("/friendship/list");
};

export const follow = (targetId: number, isFollow: number) => {
  return request.post("/following/follow", {
    friendId: targetId,
    isFollow: isFollow,
  });
};

export const getUserDetailInfo = () => {
  return request.get("/user/detail");
};

export const updateUserInfo = (data: UserInfoForm) => {
  return request.put("/user-profile/modify", data);
};

export const getUnreadMessageCount = () => {
  return request.get("/message/unread");
};
